Cache size change

ABSTRACT

A method includes determining, by a level one (L1) controller, to change a size of a L1 main cache; servicing, by the L1 controller, pending read requests and pending write requests from a central processing unit (CPU) core; stalling, by the L1 controller, new read requests and new write requests from the CPU core; writing back and invalidating, by the L1 controller, the L1 main cache. The method also includes receiving, by a level two (L2) controller, an indication that the L1 main cache has been invalidated and, in response, flushing a pipeline of the L2 controller; in response to the pipeline being flushed, stalling, by the L2 controller, requests received from any master; reinitializing, by the L2 controller, a shadow L1 main cache. Reinitializing includes clearing previous contents of the shadow L1 main cache and changing the size of the shadow L1 main cache.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims priority to U.S. Provisional PatentApplication No. 62/852,416, which was filed May 24, 2019, is titled“Cache Coherence,” and is hereby incorporated herein by reference in itsentirety.

BACKGROUND

Some memory systems include a multi-level cache system, in which ahierarchy of memories (e.g., caches) provides varying access speeds tocache data. A first level (L1) cache is closely coupled to a centralprocessing unit (CPU) core and provides the CPU core with relativelyfast access to cache data. A second level (L2) cache is also coupled tothe CPU core and, in some examples, is larger and thus holds more datathan the L1 cache, although the L2 cache provides relatively sloweraccess to cache data than the L1 cache. Additional memory levels of thehierarchy are possible.

SUMMARY

In accordance with at least one example of the disclosure, a methodincludes determining, by a level one (L1) controller, to change a sizeof a L1 main cache; servicing, by the L1 controller, pending readrequests and pending write requests from a central processing unit (CPU)core; stalling, by the L1 controller, new read requests and new writerequests from the CPU core; writing back and invalidating, by the L1controller, the L1 main cache. The method also includes receiving, by alevel two (L2) controller, an indication that the L1 main cache has beeninvalidated and, in response, flushing a pipeline of the L2 controller;in response to the pipeline being flushed, stalling, by the L2controller, requests received from any master; reinitializing, by the L2controller, a shadow L1 main cache. Reinitializing includes clearingprevious contents of the shadow L1 main cache and changing the size ofthe shadow L1 main cache.

In accordance with at least one example of the disclosure, an apparatus,includes a central processing unit (CPU) core and a level one (L1) cachesubsystem coupled to the CPU core. The L1 cache subsystem includes a L1main cache and a L1 controller. The L1 controller is configured todetermine to change a size of the L1 main cache, service pending readrequests and pending write requests from the CPU core, stall new readrequests and new write requests from the CPU core, and write back andinvalidate the L1 main cache. The apparatus also includes a level two(L2) cache subsystem coupled to the L1 cache subsystem. The L2 cachesubsystem includes a L2 main cache, a shadow L1 main cache, and a L2controller. The L2 controller is configured to receive an indicationthat the L1 main cache has been invalidated and, in response, flush apipeline of the L2 controller; in response to the pipeline beingflushed, stall requests received from any master; and reinitialize theshadow L1 main cache. Reinitializing includes clearing previous contentsof the shadow L1 main cache and changing the size of the shadow L1 maincache.

In accordance with another example of the disclosure, a method includesreceiving, by a level two (L2) controller, an indication that the alevel one (L1) main cache has been invalidated and, in response,flushing a pipeline of the L2 controller; in response to the pipelinebeing flushed, stalling, by the L2 controller, requests received fromany master; and reinitializing, by the L2 controller, a shadow L1 maincache. Reinitializing includes clearing previous contents of the shadowL1 main cache and changing the size of the shadow L1 main cache.

In accordance with at least one example of the disclosure, an apparatusincludes a CPU core and a L1 cache subsystem coupled to the CPU core.The L1 cache subsystem includes a L1 main cache, a L1 victim cache, anda L1 controller. The apparatus includes a L2 cache subsystem coupled tothe L1 cache subsystem. The L2 cache subsystem includes a L2 main cache,a shadow L1 main cache, a shadow L1 victim cache, and a L2 controller.The L2 controller receives an indication from the L1 controller that acache line A is being relocated from the L1 main cache to the L1 victimcache; in response to the indication, update the shadow L1 main cache toreflect that the cache line A is no longer located in the L1 main cache;and in response to the indication, update the shadow L1 victim cache toreflect that the cache line A is located in the L1 victim cache.

In accordance with at least one example of the disclosure, a methodincludes receiving, by a level two (L2) controller of a L2 cachesubsystem, an indication from a level one (L1) cache subsystem that acache line A is being relocated from a L1 main cache to a L1 victimcache; in response to the indication, updating, by the L2 controller, ashadow L1 main cache of the L2 cache subsystem to reflect that the cacheline A is no longer located in the L1 main cache; and in response to theindication, updating a shadow L1 victim cache of the L2 cache subsystemto reflect that the cache line A is located in the L1 victim cache.

In accordance with at least one example of the disclosure, a level two(L2) cache subsystem includes a L2 main cache; a shadow level one (L1)main cache; a shadow L1 victim cache; and a L2 controller. The L2controller is configured to: receive an indication from a level one (L1)controller that a cache line A is being relocated from a L1 main cacheto a L1 victim cache; in response to the indication, update the shadowL1 main cache to reflect that the cache line A is no longer located inthe L1 main cache; and in response to the indication, update the shadowL1 victim cache to reflect that the cache line A is located in the L1victim cache.

In accordance with at least one example of the disclosure, a systemincludes a non-coherent component; a coherent, non-caching component; acoherent, caching component; and a level two (L2) cache subsystemcoupled to the non-coherent component, the coherent, non-cachingcomponent, and the coherent, caching component. The L2 cache subsystemincludes a L2 cache; a shadow level one (L1) main cache; a shadow L1victim cache; and a L2 controller. The L2 controller is configured toreceive and process a first transaction from the non-coherent component;receive and process a second transaction from the coherent, non-cachingcomponent; and receive and process a third transaction from thecoherent, caching component.

In accordance with another example of the disclosure, a method includesmaintaining, by a level two (L2) cache controller, a L2 cache, a shadowlevel one (L1) main cache and a shadow L1 victim cache; receiving andprocessing, by the L2 cache controller, a first transaction from anon-coherent component; receiving and processing, by the L2 cachecontroller, a second transaction from a coherent, non-caching component;and receiving and processing, by the L2 cache controller, a thirdtransaction from a coherent, caching component.

In accordance with at least one example of the disclosure, an apparatusincludes a CPU core and a L1 cache subsystem including a L1 main cache,a L1 victim cache, and a L1 controller. The apparatus includes a L2cache subsystem including a L2 main cache, a shadow L1 main cache, ashadow L1 victim cache, and a L2 controller configured to receive a readrequest from the L1 controller as a single transaction. Read requestincludes a read address, a first indication of an address and acoherence state of a cache line A to be moved from the L1 main cache tothe L1 victim cache to allocate space for data returned in response tothe read request, and a second indication of an address and a coherencestate of a cache line B to be removed from the L1 victim cache inresponse to the cache line A being moved to the L1 victim cache.

In accordance with at least one example of the disclosure, a methodincludes receiving, by a level two (L2) controller, a read request froma level one (L1) controller as a single transaction. The read requestincludes a read address, a first indication of an address and acoherence state of a cache line A to be moved from a L1 main cache to aL1 victim cache to allocate space for data returned in response to theread request, and a second indication of an address and a coherencestate of a cache line B to be removed from the L1 victim cache inresponse to the cache line A being moved to the L1 victim cache.

In accordance with at least one example of the disclosure, a level two(L2) cache subsystem, includes a L2 main cache, a shadow L1 main cache,a shadow L1 victim cache, and a L2 controller configured to receive aread request in a single transaction from a level one (L1) controller.The read request includes a read address, a first indication of anaddress and a coherence state of a cache line A to be moved from a L1main cache to a L1 victim cache to allocate space for data returned inresponse to the read request, and a second indication of an address anda coherence state of a cache line B to be removed from the L1 victimcache in response to the cache line A being moved to the L1 victimcache.

In accordance with at least one example of the disclosure, an apparatusincludes a CPU core and a L1 cache subsystem including a L1 main cache,a L1 victim cache, and a L1 controller. The apparatus includes a L2cache subsystem coupled to the L1 cache subsystem by a transaction busand a tag update bus. The L2 cache subsystem includes a L2 main cache, ashadow L1 main cache, a shadow L1 victim cache, and a L2 controller. TheL2 controller receives a message from the L1 controller over the tagupdate bus, including a valid signal, an address, and a coherence state.In response to the valid signal being asserted, the L2 controlleridentifies an entry in the shadow L1 main cache or the shadow L1 victimcache having an address corresponding to the address of the message andupdates a coherence state of the identified entry to be the coherencestate of the message.

In accordance with at least one example of the disclosure, a methodincludes receiving, by a level two (L2) controller, a message from alevel one (L1) controller over a tag update bus separate from atransaction bus between the L2 controller and the L1 controller, themessage comprising a valid signal, an address, and a coherence state.The method also includes, in response to the valid signal beingasserted, identifying, by the L2 controller, an entry in a shadow L1main cache or a shadow L1 victim cache having an address correspondingto the address of the message; and updating, by the L2 controller, acoherence state of the identified entry to be the coherence state of themessage.

In accordance with at least one example of the disclosure, an apparatusincludes a central processing unit (CPU) core and a level one (L1) cachesubsystem coupled to the CPU core. The L1 cache subsystem includes a L1main cache, a L1 victim cache, and a L1 controller. The apparatusincludes a level two (L2) cache subsystem coupled to the L1 cachesubsystem by a transaction bus and a tag update bus. The L2 cachesubsystem includes a L2 main cache, a shadow L1 main cache, a shadow L1victim cache, and a L2 controller. The L2 controller is configured toreceive a message from the L1 controller over the tag update bus, themessage comprising a valid signal and an address. In response to thevalid signal being asserted, the L2 controller identifies an entry inthe shadow L1 victim cache having an address corresponding to theaddress of the message and updates a coherence state of the identifiedentry to be invalid.

In accordance with at least one example of the disclosure, a methodincludes receiving, by a level two (L2) controller, a first request fora cache line in a shared cache coherence state; mapping, by the L2controller, the first request to a second request for a cache line in anexclusive cache coherence state; and responding, by the L2 controller,to the second request.

In accordance with at least one example of the disclosure, a methodincludes receiving, by a level two (L2) controller, a first request fora cache line in a shared cache coherence state; determining, by the L2controller, that the cache line is not present in a L2 cache; mapping,by the L2 controller, the first request to a second request for a cacheline in an exclusive cache coherence state; and forwarding, by the L2controller, the second request.

In accordance with at least one example of the disclosure, an apparatusincludes a central processing unit (CPU) core, a level one (L1) cachesubsystem coupled to the CPU core, and a level two (L2) cache subsystemcoupled to the L1 cache subsystem. The L2 cache subsystem includes a L2main cache and a L2 controller. The L2 controller is configured toreceive a first request for a cache line in a shared cache coherencestate, map the first request to a second request for a cache line in anexclusive cache coherence state, and respond to the second request.

BRIEF DESCRIPTION OF THE DRAWINGS

For a detailed description of various examples, reference will now bemade to the accompanying drawings in which:

FIG. 1 shows a block diagram of a multi-level cache system in accordancewith various examples;

FIG. 2 shows another block diagram of a multi-level cache system inaccordance with various examples;

FIG. 3 shows another block diagram of a multi-level cache systemincluding level one (L1) main and victim caches in accordance withvarious examples;

FIGS. 4a-4f show flow charts of methods for processing varioustransaction types in accordance with various examples;

FIG. 5 shows an example organization of the L1 main cache and the L1victim cache in accordance with various examples;

FIG. 6 shows an example organization of level two (L2) shadow L1 maincache and shadow L1 victim cache in accordance with various examples;

FIG. 7 shows an example of a read allocate in the L1 main and victimcaches in accordance with various examples;

FIG. 8 shows an example of a read allocate in the L2 shadow L1 main andshadow L1 victim caches in accordance with various examples;

FIG. 9 shows a table of sideband signaling protocol data in accordancewith various examples;

FIG. 10 shows a table of tag update protocol data in accordance withvarious examples;

FIG. 11 shows a block diagram illustrating shared state suppression inaccordance with various examples;

FIG. 12 shows a flow chart of a method for shared state suppression inaccordance with various examples; and

FIG. 13 shows a flow chart of a method for changing a cache size inaccordance with various examples.

DETAILED DESCRIPTION

FIG. 1 shows a block diagram of a system 100 in accordance with anexample of this disclosure. The example system 100 includes multiple CPUcores 102 a-102 n. Each CPU core 102 a-102 n is coupled to a dedicatedL1 cache 104 a-104 n and a dedicated L2 cache 106 a-106 n. The L2 caches106 a-106 n are, in turn, coupled to a shared third level (L3) cache 108and a shared main memory 110 (e.g., double data rate (DDR) random-accessmemory (RAM)). In other examples, a single CPU core 102 is coupled to aL1 cache 104, a L2 cache 106, a L3 cache 108, and main memory 110.

In some examples, the CPU cores 102 a-102 n include a register file, aninteger arithmetic logic unit, an integer multiplier, and program flowcontrol units. In an example, the L1 caches 104 a-104 n associated witheach CPU core 102 a-102 n include a separate level one program cache(L1P) and level one data cache (L1D). The L2 caches 106 a-106 n arecombined instruction/data caches that hold both instructions and data.In certain examples, a CPU core 102 a and its associated L1 cache 104 aand L2 cache 106 a are formed on a single integrated circuit.

The CPU cores 102 a-102 n operate under program control to perform dataprocessing operations upon data. Instructions are fetched beforedecoding and execution. In the example of FIG. 1, L1P of the L1 cache104 a-104 n stores instructions used by the CPU cores 102 a-102 n. A CPUcore 102 first attempts to access any instruction from L1P of the L1cache 104. L1D of the L1 cache 104 stores data used by the CPU core 102.The CPU core 102 first attempts to access any required data from L1cache 104. The two L1 caches 104 (L1P and L1D) are backed by the L2cache 106, which is a unified cache. In the event of a cache miss to theL1 cache 104, the requested instruction or data is sought from L2 cache106. If the requested instruction or data is stored in the L2 cache 106,then it is supplied to the requesting L1 cache 104 for supply to the CPUcore 102. The requested instruction or data is simultaneously suppliedto both the requesting cache and CPU core 102 to speed use.

The unified L2 cache 106 is further coupled to a third level (L3) cache108, which is shared by the L2 caches 106 a-106 n in the example ofFIG. 1. The L3 cache 108 is in turn coupled to a main memory 110. Aswill be explained in further detail below, memory controllers facilitatecommunication between various ones of the CPU cores 102, the L1 caches104, the L2 caches 106, the L3 cache 108, and the main memory 110. Thememory controller(s) handle memory centric functions such as cacheabiltydetermination, cache coherency implementation, error detection andcorrection, address translation and the like. In the example of FIG. 1,the CPU cores 102 are part of a multiprocessor system, and thus thememory controllers also handle data transfer between CPU cores 102 andmaintain cache coherence among CPU cores 102. In other examples, thesystem 100 includes only a single CPU core 102 along with its associatedL1 cache 104 and L2 cache 106.

FIG. 2 shows a block diagram of a system 200 in accordance with examplesof this disclosure. Certain elements of the system 200 are similar tothose described above with respect to FIG. 1, although shown in greaterdetail. For example, a CPU core 202 is similar to the CPU core 102described above. The L1 cache 104 subsystem described above is depictedas L1D 204 and L1P 205. The L2 cache 106 described above is shown hereas L2 cache subsystem 206. An L3 cache 208 is similar to the L3 cache108 described above. The system 200 also includes a streaming engine 210coupled to the L2 cache subsystem 206. The system 200 also includes amemory management unit (MMU) 207 coupled to the L2 cache subsystem 206.

The L2 cache subsystem 206 includes L2 tag ram 212, L2 coherence (e.g.,MESI) data 214, shadow L1 tag ram 216, and L1 coherence (e.g., MESI)data 218. Each of the blocks 212, 214, 216, 218 are alternately referredto as a memory or a RAM. The L2 cache subsystem 206 also includes tagram error correcting code (ECC) data 220. In an example, the ECC data220 is maintained for each of the memories 212, 214, 216, 218.

The L2 cache subsystem 206 includes L2 controller 222, the functionalityof which will be described in further detail below. In the example ofFIG. 2, the L2 cache subsystem 206 is coupled to memory (e.g., L2 SRAM224) including four banks 224 a-224 d. An interface 230 performs dataarbitration functions and generally coordinates data transmissionbetween the L2 cache subsystem 206 and the L2 SRAM 224, while an ECCblock 226 performs error correction functions. The L2 cache subsystem206 includes one or more control or configuration registers 228.

In the example of FIG. 2, the L2 SRAM is depicted as four banks 224a-224 d. However, in other examples, the L2 SRAM includes more or fewerbanks, including being implemented as a single bank. The L2 SRAM 224serves as the L2 cache and is alternately referred to herein as L2 cache224.

The L2 tag ram 212 includes a list of the physical addresses whosecontents (e.g., data or program instructions) have been cached to the L2cache 224. In an example, an address translator translates virtualaddresses to physical addresses. In one example, the address translatorgenerates the physical address directly from the virtual address. Forexample, the lower n bits of the virtual address are used as the leastsignificant n bits of the physical address, with the most significantbits of the physical address (above the lower n bits) being generatedbased on a set of tables configured in main memory. In this example, theL2 cache 224 is addressable using physical addresses. In certainexamples, a hit/miss indicator from a tag ram 212 look-up is stored.

The L2 MESI memory 214 maintains coherence data to implement full MESIcoherence with L2 SRAM 224, external shared memories, and data cached inL2 cache from other places in the system 200. The functionalities ofsystem 200 coherence are explained in further detail below.

The L2 cache subsystem 206 also shadows L1D tags in the L1D shadow tagram 216 and L1D MESI memory 218. The tag ram ECC data 220 provides errordetection and correction for the tag memories and, additionally, for oneor both of the L2 MESI memory 214 and the L1D MESI memory 218. The L2cache controller 222 generally controls the operations of the L2 cachesubsystem 206, including handling coherency operations both internal tothe L2 cache subsystem 206 and among the other components of the system200.

FIG. 3 shows a block diagram of a system 300 that demonstrates variousfeatures of cache coherence implemented in accordance with examples ofthis disclosure. The system 300 contains elements similar to thosedescribed above with respect to FIGS. 1 and 2. For example, the CPU core302 is similar to the CPU cores 102, 202. FIG. 3 also includes a L1cache subsystem 304, a L2 cache subsystem 306, and an L3 cache subsystem308. The L1 cache subsystem 304 includes a L1 controller 310 coupled toL1 SRAM 312. The L1 controller 310 is also coupled to a L1 main cache314 and a L1 victim cache 316, which are explained in further detailbelow. In some examples, the L1 main and victim caches 314, 316implement the functionality of L1D 204 and/or L1P 205.

The L1 controller 310 is coupled to a L2 controller 320 of the L2 cachesubsystem 306. The L2 controller 320 also couples to L2 SRAM 322. The L2controller 320 couples to a L2 cache 324 and to a shadow of the L1 maincache 326 as well as a shadow of the L1 victim cache 328. L2 cache 324and L2 SRAM 322 are shown separately for ease of discussion, althoughmay be implemented physically together (e.g., as part of L2 SRAM 224,including in a banked configuration, as described above. Similarly, theshadow L1 main cache 326 and the shadow L1 victim cache 328 may beimplemented physically together, and are similar to the L1D shadow tagram 216 and the L1D MESI 218, described above. The L2 controller 320 isalso coupled to a L3 controller 309 of the L3 cache subsystem 308. L3cache and main memory (e.g., DDR 110 described above) are not shown forsimplicity.

Cache coherence is a technique that allows data and program caches, aswell as different requestors (including requestors that do not havecaches) to determine the most current data value for a given address inmemory. Cache coherence enables this coherent data value to beaccurately reflected to observers (e.g., a cache or requestor thatissues commands to read a given memory location) present in the system300. Certain examples of this disclosure refer to an exemplary MESIcoherence scheme, in which a cache line is set to one of four cachecoherence states: modified, exclusive, shared, or invalid. Otherexamples of this disclosure refer to a subset of the MESI coherencescheme, while still other examples include more coherence states thanthe MESI coherence scheme. Regardless of the coherence scheme, cachecoherence states for a given cache line are stored in, for example, theL2 MESI memory 214 described above.

A cache line having a cache coherence state of modified indicates thatthe cache line is modified with respect to main memory (e.g., DDR 110),and the cache line is held exclusively in the current cache (e.g., theL2 cache 324). A modified cache coherence state also indicates that thecache line is explicitly not present in any other caches (e.g., L1 or L3caches).

A cache line having a cache coherence state of exclusive indicates thatthe cache line is not modified with respect to main memory (e.g., DDR110), but the cache line is held exclusively in the current cache (e.g.,the L2 cache 324). An exclusive cache coherence state also indicatesthat the cache line is explicitly not present in any other caches (e.g.,L1 or L3 caches).

A cache line having a cache coherence state of shared indicates that thecache line is not modified with respect to main memory (e.g., DDR 110).A shared cache state also indicates that the cache line may be presentin multiple caches (e.g., caches in addition to the L2 cache 324).

A cache line having a cache coherence state of invalid indicates thatthe cache line is not present in the cache (e.g., the L2 cache 324).

Examples of this disclosure leverage hardware techniques, control logic,and/or state information to implement a coherent system. Each observercan issue read requests—and certain observers are able to issue writerequests—to memory locations that are marked shareable. Caches inparticular can also have snoop requests issued to them, requiring theircache state to be read, returned, or even updated, depending on the typeof the snoop operation. In the exemplary multi-level cache hierarchydescribed above, the L2 cache subsystem 306 is configured to both sendand receive snoop operations. The L1 cache subsystem 304 receives snoopoperations, but does not send snoop operations. The L3 cache subsystem308 sends snoop operations, but does not receive snoop operations. Inexamples of this disclosure, the L2 cache controller 320 maintains stateinformation (e.g., in the form of hardware buffers, memories, and logic)to additionally track the state of coherent cache lines present in boththe L1 main cache 314 and the L1 victim cache 316. Tracking the state ofcoherent cache lines enables the implementation of a coherent hardwarecache system.

Examples of this disclosure refer to various types of coherenttransactions, including read transactions, write transactions, snooptransactions, victim transactions, and cache maintenance operations(CMO). These transactions are at times referred to as reads, writes,snoops, victims, and CMOs, respectively.

Reads return the current value for a given address, whether that valueis stored at the endpoint (e.g., DDR 110), or in one of the caches inthe coherent system 300. Writes update the current value for a givenaddress, and invalidate other copies for the given address stored incaches in the coherent system 300. Snoops read or invalidate (or both)copies of data stored in caches. Snoops are initiated from anumerically-higher level of the hierarchy to a cache at the next,numerically-lower level of the hierarchy (e.g., from the L2 controller320 to the L1 controller 310), and are able be further propagated toeven lower levels of the hierarchy as needed. Victims are initiated froma numerically-lower level cache in the hierarchy to the next,numerically-higher level of the cache hierarchy (e.g., from the L1controller 310 to the L2 controller 320). Victims transfer modified datato the next level of the hierarchy. In some cases, victims are furtherpropagated to numerically-higher levels of the cache hierarchy (e.g., ifthe L2 controller 310 sends a victim to the L2 controller 320 for anaddress in the DDR 110, and the line is not present in the L2 cache 324,the L2 controller 320 forwards the victim to the L3 controller 309).Finally, CMOs cause an action to be taken in one of the caches for agiven address.

Still referring to FIG. 3, in one example, the L1 main cache 314 is adirect mapped cache that services read and write hits and snoops. The L1main cache 314 also keeps track of cache coherence state information(e.g., MESI state) for its cache lines. In an example, the L1 main cache314 is a read-allocate cache. Thus, writes that miss the L1 main cache314 are sent to L2 cache subsystem 306 without allocating space in theL1 main cache 314. In the example where the L1 main cache 314 is directmapped, when a new allocation takes place in the L1 main cache 314, thecurrent line in the set is moved to the L1 victim cache 316, regardlessof whether the line is clean (e.g., unmodified) or dirty (e.g.,modified).

In an example, the L1 victim cache 316 is a fully associative cache thatholds cache lines that have been removed from the L1 main cache 314, forexample due to replacement. The L1 victim cache 316 holds both clean anddirty lines. The L1 victim cache 316 services read and write hits andsnoops. The L1 victim cache 316 also keeps track of cache coherencestate information (e.g., MESI state) for its cache lines. When a cacheline in the modified state is replaced from the L1 victim cache 316,that cache line is sent to the L2 cache subsystem 306 as a victim.

As explained above, the L2 cache subsystem 306 includes a unified L2cache 324 that is used to service requests from multiple requestortypes, including L1D and L1P (through the L1 controller 310), thestreaming engine 210, a memory management unit (MMU 207), and the L3cache (through the L3 controller 309). In an example, the L2 cache 324is non-inclusive with the L1 cache subsystem 304, which means that theL2 cache 324 is not required to include all cache lines stored in the L1caches 314, 316, but that some lines may be cached in both levels.Continuing this example, the L2 cache 324 is also non-exclusive, whichmeans that cache lines are not explicitly prevented from being cached inboth the L1 and L2 caches 314, 316, 324. For example, due to allocationand random replacement, cache lines may be present in one, both, orneither of the L1 and L2 caches. The combination of non-inclusive andnon-exclusive cache policies enables the L2 controller 320 to manage itscache contents without requiring the L1 controller 310 to invalidate orremove cache lines. This simplifies processing in the L2 cache subsystem306 and enables increased performance for the CPU core 302 by allowingcritical data to remain cached in the L1 cache subsystem 304 even if ithas been evicted from the L2 cache 324.

Still referring to FIG. 3, the L2 controller 320 described hereincombines both local coherence (e.g., handling requests targeting itslocal L2 SRAM 322 as an endpoint) and external coherence (e.g., handlingrequests targeting external memories, such as L3 SRAM (not shown forsimplicity) or DDR 110 as endpoints). An endpoint refers to a memorytarget such as L2 SRAM 322 or DDR 110 that resides at a particularlocation on the chip, is acted upon directly by a single controllerand/or interface, and may be cached at various levels of a coherentcache hierarchy, such as depicted in FIG. 3. A master (e.g., a hardwarecomponent, circuitry, or the like) refers to a requestor that issuesread and write accesses to an endpoint. In some examples, a masterstores the results of these read and write accesses in a cache, althoughthe master does not necessarily store such results in a cache.

Local coherence requests are received by the L2 controller 320 from, forexample, the CPU core 302 or as a direct memory access (DMA) requestfrom another CPU core or a master associated with another CPU core.External coherence requests are received by the L2 controller 320 from,for example, the CPU core 302 or L3 controller 309. Thus, the single L2controller 320 is configured to address both local and externalcoherence.

In accordance with various examples, the L2 controller 320 manages theCPU core 302 coherent view of three endpoints: L2 SRAM 322, L3 SRAM(part of the L3 cache subsystem 308, not shown for simplicity), and mainmemory or DDR 110, described above. For ease of discussion, L3 SRAM andDDR 110 are grouped together and referred to as an “external” memory orendpoint, which distinguishes them from the L2 SRAM 322 as a “local”(e.g., to the L2 controller 320) memory or endpoint.

A master refers to a requestor that issues read and write accesses to anendpoint. In some examples, a master stores the results of these readand write accesses in a cache, although the master does not necessarilystore such results in a cache. Coherent masters (e.g., masters for whomcoherence must be handled by L2 controller 320) are classified as eithercaching or non-caching. Non-coherent masters (e.g., masters that do notrequire coherent data) are not distinguished as caching or non-cachingdue to their being non-coherent. Referring briefly back to FIG. 2, insome examples non-coherent masters include L1P 205. Coherent,non-caching masters include MMU 207, SE 210, and L3 208. Coherent,caching masters include L1D 204.

The L2 controller 320 is configured to provide coherent access to bothinternal and external endpoints for coherent masters, while alsoproviding access to those internal and external endpoints fornon-coherent masters. As will be explained in further detail below, theL2 controller manages coherent state information, issues coherencetransactions (e.g., snoop, victim) to maintain proper coherence states,and propagates information as needed to the downstream controllers suchas the L3 controller 309 to provide a coherent view of the memory storedin the L2 cache subsystem 306.

As will be explained further below, the L2 controller 320 is configuredto perform normal cache allocation, replacement, and victimizationoperations, while also sending coherent transactions to communicate thestorage of coherent locations within the L2 cache subsystem 306 or L1cache subsystem 304. As a result, downstream cache controllers such asthe L3 controller 309 are able to maintain the directory information, ifso enabled, about what addresses are held in the L1 and L2 cachesubsystems 304, 306.

In accordance with examples of this disclosure, the L2 controller 320 ispart of a system that includes a non-coherent master; a non-caching,coherent master; and a caching, coherent master. The L2 controller 320is configured to receive and process transactions from each of thesemasters, while maintaining global coherence (e.g., with respect toexternal memories) and local coherence (e.g., with respect to its localmemory) as required by the particular master. Thus, the L2 controller320 also enables interleaving of coherent and non-coherent traffic amongthe various masters.

The following table summarizes interactions between various masters andthe L2 controller 320 in accordance with various examples. Inparticular, Table 1 indicates for a particular master what transactiontypes that master can initiate to the L2 controller 320, whattransaction types the L2 controller 320 can initiate to that master, andwhether global and/or local coherence is supported by the L2 controller320 for that master.

TABLE 1 Master- L2- initiated initiated Global Local Master transactiontransaction coherence? coherence? L1P 205 Read None No Yes MMU 207 ReadNone Yes Yes SE 210 Read, CMO None Yes Yes L1D 204 R, W, Victim SnoopYes Yes L3 208 Snoop R, W, Victim Yes No DMA Read, Write None No Yes

FIG. 4a shows a method 400 carried out by the L2 controller 320 inresponse to a read request from a non-coherent master, such as L1P 205.The method 400 begins in block 402 with the L2 controller 320 receivinga read request from a non-coherent master, and continues in block 404with reading data from an endpoint based on the read request. Althoughnot explicitly shown, if the read request hits in the L2 cache 324, theL2 controller 320 is configured to read the data from the L2 cache 324.On the other hand, if the read request does not hit in the L2 cache 324,the L2 controller 320 is configured to read the data from an endpoint,such as the L3 cache subsystem 308 or DDR 110. Once the L2 controller320 has read response data (either from L2 cache 324 or from anendpoint), the method 400 continues to block 406 in which the L2controller 320 returns the read response data to the non-coherentmaster.

FIG. 4b shows a method 410 carried out by the L2 controller 320 inresponse to a read request from a coherent, non-caching master, such asMMU 207, SE 210, and L3 208. When coherent, non-caching masters issueread commands to the L2 controller 320, either to a local endpoint orexternal endpoint, the L2 controller 320 determines if the line ispresent in the L1 cache 314, 316, and if so, whether a snoop commandshould be issued to obtain the latest copy from L1 caches 314, 316, orif the data can be obtained from the endpoint (e.g., L2 SRAM 322) or theL2 cache 324 (if present). Due to variations in access latency for alocal endpoint (faster) compared to an external endpoint (slower), theL2 controller 320 makes multiple decisions for where and how to obtain acoherent memory location in response to a read command from anon-caching master.

The method 410 begins in block 412 with the L2 controller 320 receivinga read request from a coherent, non-caching master, and continues inblock 414 with the L2 controller 320 determining whether the readrequest hits in the shadow L1 main cache 326 or the shadow L1 victimcache 328, which indicates that the requested data may be present in theL1 cache subsystem 304.

If, in block 414, the read request does not hit in the shadow L1 caches326, 328, the method 410 continues in block 416 in which the L2controller 320 reads the data from an endpoint and returns the data as aread response. However, if in block 414 the read request hits one of theshadow L1 caches 326, 328, the method 410 continues in block 418 withthe L2 controller 320 generating a snoop read to the L1 controller 310.If a snoop response from the L1 controller 310 contains valid data inblock 420, then the L2 controller 320 returns the snoop response data asa read response to the requesting master in block 422. If the snoopresponse from the L1 controller 310 contains invalid data in block 420,then the L2 controller 320 returns endpoint data as the read response tothe requesting master in block 416.

FIG. 4c shows a method 430 carried out by the L2 controller 320 inresponse to a read request from a coherent, caching master, such as L1D204. The method 430 makes reference to various sideband signals thatdescribe allocations that will occur in the L1 cache subsystem 304(e.g., movements of cache lines in L1 main cache 314 and L1 victim cache316) as a result of the read request. These sideband signals aredescribed in further detail below with respect to FIG. 9.

In particular, the method 430 begins in block 432 with the L2 controller320 receiving an allocating read request from a coherent, cachingmaster, which in this examples is the L1 cache subsystem 304. This readrequest includes sideband signals that indicate it is an allocatingrequest (e.g., alloc==1). The method 430 then proceeds to block 434 inwhich the L2 controller 320 writes an address and, optionally, a securebit, indicated by the sideband signals to the shadow L1 main cache 326,which now indicates the address that is being allocated to the L1 maincache 314 as a result of this read request.

The method 430 continues in block 436 with determining whether amain_valid sideband signal is asserted, which indicates that a cacheline is moving from the L1 main cache 314 to the L1 victim cache 316 asa result of this read request. If the main_valid signal is asserted, themethod 430 continues to block 438 in which the L2 controller 320 updatesits shadow L1 victim cache 328 to include an address specified bymain_address, a coherence state specified by main_mesi, and optionally asecure bit specified by main_secure. As a result, the shadow L1 victimcache 328 now includes the address and coherence state information ofthe line that is being moved from the L1 main cache 314 to the L1 victimcache 316 as a result of this read request.

If the main_valid signal is de-asserted, then a line is not being movedfrom the L1 main cache 314 to the L1 victim cache 316 as a result ofthis read request, and the method 430 continues to block 440 withdetermining whether a victim_valid sideband signal is asserted, whichindicates that a cache line is moving out of the L1 victim cache 316 asa result of this read request (e.g., is being displaced by the L1 maincache 314 to L1 victim cache 316 movement described above). If thevictim_valid signal is asserted, the method 430 continues in block 442with determining whether the coherence state specified by victim_mesi(e.g., the coherence state of the line being moved out of the L1 victimcache 316) is invalid, modified, or shared/exclusive.

If victim_mesi is invalid, the method 430 proceeds to block 448 in whichthe L2 controller 320 returns read response data from an endpoint, orthe L2 cache 324.

If victim_mesi is shared/exclusive, the method 430 continues to block444 where the L2 controller 320 removes an entry from its shadow L1victim cache 328 having an address that matches victim_address and,optionally, victim_secure. As explained further below, the L2 controller320 removes the entry in this case because a subsequent victimtransaction from the L1 controller 310 does not result when the lineevicted from L1 victim cache 316 is in the shared/exclusive state, andthus it is safe to also remove from the shadow L1 victim cache 328. Themethod 430 then proceeds to block 448 in which the L2 controller 320returns read response data from an endpoint, or the L2 cache 324.

If victim_mesi is modified, the method 430 continues to block 446 wherethe L2 controller 320 retains an entry from its shadow L1 victim cache328 having an address that matches victim_address and, optionally,victim_secure. As explained further below, the L2 controller 320 retainsthe entry in this case because a subsequent victim transaction from theL1 controller 310 is expected when the line evicted from L1 victim cache316 is in the modified state. The method 430 then proceeds to block 448in which the L2 controller 320 returns read response data from anendpoint, or the L2 cache 324.

FIG. 4d shows a method 450 carried out by the L2 controller 320 inresponse to a write request from a coherent, non-caching master, such asa DMA request from a different CPU core. The method 450 begins in block452 when the write request is received and continues to block 454 withthe L2 controller 320 determining whether the write request hits in theshadow L1 main or victim caches 326, 328. If the write request does nothit in the shadow L1 main or victim caches 326, 328, then the L2controller 320 does not need to invalidate any line in the L1 cachesubsystem 304 and the method 450 proceeds to block 456 where the L2controller 320 writes the data to an endpoint.

However, if the write request hits in the shadow L1 main or victimcaches 326, 328, then the method 450 proceeds to block 458 in which theL2 controller 320 issues a snoop read and invalidate request to the L1cache subsystem 304. If the snoop response has dirty (e.g., modified)data in block 460, then the L2 controller 320 merges the write data overthe snoop response data and writes to an endpoint in block 462. If thesnoop response contains unmodified data in block 460, then the L2controller 320 writes the write data to the endpoint in block 456.

FIG. 4e shows a method 470 carried out by the L2 controller 320 inresponse to a victim from a L1D 204, which is a coherent, cachingmaster. The method 470 begins in block 472 with the L2 controller 320receiving a victim from the L1 controller 310. If a victim address and,optionally, secure bit hits in the shadow L1 victim cache 328 in block474, the L2 controller 320 is configured to update the shadow L1 victimcache 328 to invalidate a corresponding address if necessary. The method470 then continues in block 478, in which the L2 controller 320 updatesan endpoint with the victim data. However, if the victim address and,optionally, secure bit does not hit in the shadow L1 victim cache 328 inblock 474, then the method 470 proceeds to block 478 and the L2controller 320 updates an endpoint with the victim data withoutmodifying the shadow L1 victim cache 328.

FIG. 4f shows a method 480 carried out by the L2 controller 320 inresponse to a snoop command from L3 208, which is a coherent,non-caching master. The method 480 begins in block 482 in which the L2controller 320 receives a snoop request from the L3 controller 309. If,in block 484, the snoop request hits in the shadow L1 main or victimcaches 326, 328, the method 480 continues in block 486 with the L2controller 320 issuing a snoop read 486 to the L1 controller 310. Themethod 480 then continues in block 488 with the L2 controller 320determining whether the snoop response from the L1 controller 310 hasvalid data.

If the snoop response from the L1 controller 310 contains invalid data(or if the snoop request did not hit in the shadow L1 main or victimcaches 326, 328 in block 484), the method 480 continues to block 490 inwhich the L2 controller 320 determines whether the snoop read hits inthe L2 cache 324. If the snoop read does not hit in the L2 cache 324,the method 480 continues to block 492 and the L2 controller 320 issues asnoop miss to the L3 controller 309. However, if the snoop read hits inthe L2 cache 324, the method 480 continues to block 493 in which the L2controller 320 reads the data from the L2 cache 324 and to block 494 inwhich the L2 controller 320 updates a coherence state as needed. Thenthe L2 controller 320 returns the data from the L2 cache 324 as snoopresponse data to the L3 controller 309 in block 495.

If the snoop response from the L1 controller 310 contains valid data inblock 488, the method 480 continues to block 496 in which the L2controller 320 determines whether the snoop response from the L1controller 310 hits in the L2 cache 324. If the snoop response from theL1 controller 310 hits in the L2 cache 324, the method 480 continues toblock 497 in which the L2 controller 320 updates a coherence state ofthe L2 cache 324 as needed. Then, the L2 controller 320 returns thesnoop response data from the L1 controller 310 as a snoop response tothe L3 controller 309 in block 498. If the snoop response from the L1controller 310 does not hit in the L2 cache 324, the method 480 proceedsdirectly to block 498, in which the L2 controller 320 returns the snoopresponse data from the L1 controller 310 as a snoop response to the L3controller 309.

The foregoing are examples of ways in which the L2 controller 320receives and processes various types of transactions from various typesof masters, including non-coherent masters; coherent, non-cachingmasters; and coherent, caching masters. By handling such diversecombinations of transactions and master requirements in a single,unified controller, overall system flexibility is enhanced.

As explained, there is a need for the L2 cache subsystem 306 to includehardware, control logic, and/or state information to allow the L2controller at 320 to accurately track and process the state of coherent,cache lines in the lower-level L1 cache subsystem 304. In this example,the L1 cache subsystem 304 is utilizing a heterogeneous cache system,including the L1 main cache 314 and the L1 victim cache 316. Examples ofthis disclosure allow the L2 controller 320 to maintain appropriatestate information to accurately track the state of all coherent cachelines present in both the L1 main cache 314 and L1 victim cache 316.

FIG. 5 shows an example of the L1 main cache 314 and the L1 victim cache316. In this example, as explained above, the L1 main cache 314 is adirect mapped cache, which thus has one way (Way 0) and sets 0 throughM. Continuing this example, as explained above, the L1 victim cache 316is a fully associative cache, which thus has one set (Set 0) and ways 0through X.

FIG. 6 shows an example of the shadow L1 main cache 326 and the shadowL1 victim cache 328, contained in the L2 cache subsystem 306. The shadowL1 main cache 326 is a shadow copy of the address tag and MESI stateinformation for the cache lines held in the L1 main cache 314. Themaintenance of this shadow copy enables the L2 controller 320 to trackthe lines that are cached in the L1 main cache 314, for example tocorrectly decide when to send snoop transactions to either read orinvalidate cache lines in the L1 main cache 314. In this example, theshadow L1 main cache 326 also has one way (Way 0) and sets 0 through M,permitting the shadow L1 main cache 326 to reflect the L1 main cache314.

The shadow L1 victim cache 328 is a shadow copy of the address tag andMESI state information for the cache lines held in the L1 victim cache316. As above with respect to the shadow L1 main cache 326, themaintenance of the shadow L1 victim cache 328 enables the L2 controller320 to accurately determine when to send snoop transactions to the L1controller 310. For example, if the shadow tags were not maintained inthe L2 cache subsystem 306, then the L2 controller 320 would need tosnoop the L1 cache subsystem 304 for each request that could possibly beheld in the L1 main or victim caches 314, 316, which could reduceperformance due to the resulting snoop traffic bandwidth. In thisexample, the shadow L1 victim cache 328 includes one set (Set 0) andways 0 through X, along with floating entries, which render the shadowL1 victim cache 328 to reflect more entries than can be stored in the L1victim cache 316. The floating entries are explained in further detailbelow.

In both the shadow L1 main cache 326 and the shadow L1 victim cache 328,only the tag (e.g., address) and coherence state information isshadowed. That is, in at least this example, it is not necessary toshadow the cached data itself.

When the L2 controller 320 receives a snoop transaction or a read orwrite transaction occurs from the L3 controller 310 to the L2 controller320, the L2 controller 320 first checks the shadow L1 main and shadow L1victim caches 326, 328. If a match is found (e.g., a hit), then the L2controller 320 initiates a snoop transaction to the L1 controller 310.When the snoop transaction returns, the L2 controller 320 uses the snoopresponse to update the shadow L1 main and shadow L1 victim caches 326,328, if necessary.

Similarly, when the L1 controller 310 allocates a line in its L1 maincache 314, or moves or relocates a line from the L1 main cache 314 tothe L1 victim cache 316, the L1 controller 310 communicates suchmovement to the L2 controller 320 to enable the L2 controller 320 toupdate the shadow L1 main and shadow L1 victim caches 326, 328. When theL1 controller 310 evicts a line from either the L1 main cache 314 or theL1 victim cache 316, the line is either modified (e.g., dirty) orunmodified (e.g., clean) with respect to main memory (e.g., DDR 110).The L1 controller 310 is configured to communicate both clean lineevictions and dirty line victims to the L2 controller 320, which enablesthe L2 controller 320 to accurately update its shadow L1 main and shadowL1 victim caches 326, 328. The signaling protocol to communicate suchmovement, relocation, and evictions between the L1 controller 310 andthe L2 controller 320 is discussed in further detail below.

In an example, the L2 controller 320 learns that the L1 controller 310is kicking a line out of its L1 victim cache 316 (e.g., to make room fora line coming from the L1 main cache 314) before the L2 controller 320receives the displaced victim from the L1 victim cache 316. The linekicked out of the L1 victim cache 316 is held in a victim buffer 702(e.g., as shown in FIG. 7) prior to being sent to the L2 controller 320across the interface between the two controllers 310, 320. During thistime period, the L2 controller 320 is aware of the transfer of a linefrom the L1 main cache 314 to the L1 victim cache 316, which the L2controller will cause to be mirrored in the shadow L1 main and shadow L1victim caches 326, 328. However, the L2 controller 320 has not yetreceived the displaced victim from the L1 victim cache 316, as thedisplaced victim is still in the victim buffer 702.

The floating entries in the shadow L1 victim cache 328 address thisissue. These floating entries extend the size of the shadow L1 victimcache 328 to include at least the number of victim buffers in the L1cache subsystem 304. In one example, the floating entries result in theshadow L1 victim cache 328 having twice the number of entries as the L1victim cache 316. In an example, the exact location of entries in the L1victim cache 316 does not need to match the location of the same cacheline as it is shadowed in the shadow L1 victim cache 328. Decoupling thelocations between the L1 victim cache 316 and the shadow L1 victim cache328 improves the safety of the protocol, as a full address comparison isperformed when the L2 controller 320 looks for an entry in the L1 victimcache 316. Subsequently, when the L2 controller 320 receives thedisplaced victim across the interface from the victim buffer, the L2controller 320 causes the line to be removed from its shadow L1 victimcache 328.

FIG. 7 shows an example of an L1 cache subsystem 304 allocation of a newline at address C (e.g., line C), both before and after the allocationtakes place. FIG. 8 shows the corresponding example from the view of theL2 cache subsystem 306. Referring first to FIGS. 7 and 8 at once, beforethe allocation takes place, the L1 main cache 314 contains a cache lineA that is in the modified (M) state, and the L1 victim cache 316contains a cache line B that is also in the modified state. At the sametime, the shadow L1 main cache 326 also contains the cache line A (e.g.,tag and MESI data for the cache line A), which is in the same relativephysical location within the shadow L1 main cache 326 as the cache lineA in the L1 main cache 314. Similarly, the shadow L1 victim cache 328also contains the cache line B (e.g., tag and MESI data for the cacheline B), which is not necessarily in the same relative physical locationwithin the shadow L1 victim cache 328 as the cache line B in the L1victim cache 316.

When the L1 controller 310 decides to allocate line C, the L1 controller310 conveys this allocation to the L2 controller (e.g., as part of aread request issued by the L1 controller 310). In this example, theaddress of line C maps to the same location in the L1 main cache 314 asthe line A, and thus the L1 controller 310 relocates line A to the L1victim cache 316, in a location occupied by the line B. As a result ofthe line B being modified, the L1 controller 310 determines to send lineB to the L2 cache subsystem 306 as a victim and moves the line B to thevictim buffer 702. After the read allocate for the line C, the L1 maincache 314 contains the line C in the location that formerly held theline A, the L1 victim cache 316 contains the cache line A that wasrelocated from the L1 main cache 314, and the victim buffer 702 containsthe cache line B that was evicted from the L1 victim cache 316.

Similarly, after the read allocate for the line C (e.g., communicated bythe L1 controller 310 to the L2 controller 320 as part of the readrequest for the line C), the shadow L1 main cache 326 contains the lineC in the location that formerly held the line A and the shadow L1 victimcache 328 contains the relocated line A in one of its floating entries,while the line B also remains in the shadow L1 victim cache 328. Asexplained above, there is a period of time in which the L2 controller320 is aware that the L1 controller is moving the line A from the L1main cache 314 to the L1 victim cache 316, but the L2 controller 320 hasnot yet received the line B as a victim (e.g., the line B is still inthe victim buffer 702). The floating entries of the shadow L1 victimcache 328 provide an additional storage buffer, and the L2 controller320 is configured to remove the line B from the shadow L1 victim cache328 when the line B is received as a victim on the interface between theL2 cache subsystem 306 and the L1 cache subsystem 304.

In general and as explained above, the L2 controller 320 is configuredto receive an indication from the L1 controller 310 that a cache line isbeing relocated from the L1 main cache 314 to the L1 victim cache 316(e.g., the cache line A in the example of FIGS. 7 and 8). In response toreceiving the indication, the L2 controller 320 updates the shadow L1main cache 326 to reflect that the cache line A is no longer located inthe L1 main cache 314. Similarly, in response to receiving theindication, the L2 controller 320 updates the shadow L1 victim cache 328to reflect that the cache line A is located in the L1 victim cache 316.The signaling protocol by which the L1 controller 310 communicatesmovement of cache lines between its L1 main cache 314, L1 victim cache316, and victim buffer 702 are explained in further detail below.However, in one example the indication from the L1 controller 310 is aresponse to a snoop request from the L2 cache subsystem 306 to the L1cache subsystem 304. In another example, the indication from the L1controller 310 is a read request from the L1 cache subsystem 304 to theL2 cache subsystem 306.

These examples, in particular the floating entries of the shadow L1victim cache 328, enable cleaner handoff of a victim line from the L1cache subsystem 304 to the L2 cache subsystem 306 by removing the timingwindow where a line is removed from the L1 victim cache 316, but has notyet been received by the L2 cache subsystem 306 as a victimAdditionally, the L2 controller 320 maintaining accurate shadows of theL1 main cache 314 and the L1 victim cache 316 allows the L2 controllerto only generate snoop transactions when necessary (e.g., when the L2controller 320 is aware that a line is held in one of the L1 caches 314,316).

As explained above, the L1 controller 310 communicates movement of cachelines between its L1 main cache 314, L1 victim cache 316, and victimbuffer 702 to the L2 controller 320. In some examples, thiscommunication occurs in conjunction with a response to a snoop requestfrom the L2 cache subsystem 306 to the L1 cache subsystem 304. In otherexamples, this communication occurs in conjunction with a read requestfrom the L1 cache subsystem 304 to the L2 cache subsystem 306.

Referring back to FIG. 3, in some examples a transaction bus orinterface between the L1 cache subsystem 304 and the L2 cache subsystem306 contains a greater bandwidth than is needed to pass a transactionbetween the subsystems 304, 306. The transaction bus is representedschematically by the coupling between the L1 cache subsystem 304 and theL2 cache subsystem 306 (or similar couplings between L1 and L2structures in FIGS. 1 and 2). The transaction bus has a bandwidth of m+nbits, while a transaction (e.g., a read, a write, a snoop, a victim)only requires m bits, leaving n bits of the transaction bus unused.Examples of this disclosure leverage this excess bandwidth on thetransaction bus between the L1 cache subsystem 304 and the L2 cachesubsystem 306 to communicate information from the L1 controller 310 tothe L2 controller 320 in order to allow the L2 controller 320 tomaintain its shadow L1 main cache 326 (e.g., tag and MESI informationcorresponding to the L1 main cache 314) and shadow L1 victim cache 328(e.g., tag and MESI information corresponding to the L1 victim cache316).

In particular, the L1 controller 310 is configured, in some examples, tosend sideband signals in conjunction with a functional read transactionto the L2 controller 320. The sideband signals contain informationrelated to cache line movement (e.g., as described above with respect tothe example of FIGS. 7 and 8) occurring in the L1 cache subsystem 304.Thus, the cache line movement information is communicated in parallel(e.g., as a part of a single transaction) with the functional readtransaction that causes the cache line movement(s). The L2 controller320 not only responds to transactions and information from the L1controller 310, but the L2 controller 320 also creates and enforcessnoop transactions as required to maintain I/O (e.g., direct memoryaccess (DMA)) coherence from non-caching requestors within the system(e.g., other CPU cores 102 in the system 100 may initiate a DMA requestthat is passed to the L2 controller 320 from a L3 controller, sharedacross CPU cores 102 as shown in FIG. 1). In examples, these snooptransactions also cause the L2 controller 320 to initiate changes to itsshadow L1 main cache 326 and shadow L1 victim cache 328, as well as theL1 main cache 314 and the L1 victim cache 316. For example, if the L1controller 310 invalidates a line as a result of a snoop transaction(e.g., because the snoop transaction required invalidation, or becauseof a requirement due to the current state of the L1 main cache 314 or L1victim cache 316), the snoop response will indicate that the linetransitioned to the invalid state. The L2 controller 320 then uses thisinformation to update its shadow L1 main cache 326 or shadow L1 victimcache 328. Thus, in addition to functional read transactions, the L1controller 310 is configured to send additional sideband signals inconjunction with a response to a snoop transaction.

Examples of this disclosure reduce bandwidth on the transaction bus byavoiding the need for multiple messages to communicate both thefunctional read transaction and movements of cache lines within the L1cache subsystem 304 that will result from that read transaction.Further, examples of this disclosure reduce timing dependencies andimplementation complexity by avoiding the use of a separate asynchronousinterface to communicate cache line movement information.

FIG. 9 shows a table 900 of sideband signaling protocol data inaccordance with an example of this disclosure. The scope of thisdisclosure is not limited to any particular arrangement of signalswithin a transaction bus. For a given read transaction, the L1controller 310 indicates to the L2 controller 320 whether the readtransaction will allocate (the alloc signal) into the L1 main cache 314,and if so, which line is moving from the L1 main cache 314 to the L1victim cache 316, and which line is moving out of the L1 victim cache316. If the alloc signal is de-asserted, then the L2 controller 320disregards the remaining sideband signals.

In the table 900, the main_valid and victim_valid signals indicatewhether the other main* and victim* signals, respectively, are valid.For example, the L1 controller 310 is configured to de-assert the validsignals when transmitted in parallel with a transaction that does notresult in cache line movement(s) in the L1 main cache 314 and the L1victim cache, respectively. The main_mesi and victim_mesi signalsindicate the cache coherence state (e.g., MESI state) for a cache linemoving from the L1 main cache 314 to the L1 victim cache 316 and for acache line moving out of the L1 victim cache 316, respectively. Themain_secure and victim_secure signals indicate whether the cache linemoving from the L1 main cache 314 to the L1 victim cache 316 and thecache line moving out of the L1 victim cache 316, respectively, issecure. The main_address and victim_address signals indicate theaddresses for the cache line moving from the L1 main cache 314 to the L1victim cache 316 and for the cache line moving out of the L1 victimcache 316, respectively.

The L2 controller 320 is thus configured, in this example, to receive,in a single transaction, a read request in parallel with theaforementioned sideband signals that detail the cache line movement(s)that will occur in the L1 cache subsystem 304 as a result of the readrequest. In order for the L1 controller 310 to allocate space for datareturned in response to the read request, the sideband signals indicatean address and coherence state of the cache line moving from the L1 maincache 314 to the L1 victim cache 316 and for the cache line moving outof the L1 victim cache 316.

The L2 controller 320 is configured to update the shadow L1 main cache326 to reflect that the cache line moving from the L1 main cache 314 tothe L1 victim cache 316 is no longer present in the L1 main cache 314.Similarly, the L2 controller 320 is configured to update the shadow L1victim cache 328 to reflect that the cache line moving from the L1 maincache 314 to the L1 victim cache 316 is now present in the L1 victimcache 316. If one or more of the valid bits in the sideband signals 900are de-asserted, the L2 controller 320 is configured not to update itsshadow L1 main cache 326 (main_valid de-asserted) or its shadow L1victim cache 328 (victim_valid de-asserted).

In some examples, the L2 controller 320 is also configured to update theshadow L1 victim cache 328 to reflect that a cache line is no longerlocated in the L1 victim cache 316. In particular, if the victim_mesisignal indicates that the cache line moving out of the L1 victim cache316 has a coherence state other than modified (e.g., exclusive orshared), then the L2 controller 320 does not expect to receive acorresponding victim transaction because it is not necessary to writeback a cache line that is not dirty. On the other hand, if thevictim_mesi signal indicates that the cache line moving out of the L1victim cache 316 has a modified coherence state, then the L2 controller320 waits to receive a victim transaction (e.g., from the victim buffer702). Upon receiving the victim transaction, the L2 controller 320 isconfigured to update the shadow L1 victim cache 328 to reflect that acache line is no longer located in the L1 victim cache 316.

The foregoing examples reduce bandwidth on the transaction bus betweenthe L1 cache subsystem 304 and the L2 cache subsystem 306 by avoidingthe need for multiple messages to communicate both the functional readtransaction and the movements of cache lines within the L1 cachesubsystem 304 that will result from that read transaction.

The sideband signaling protocol discussed above leverages unusedbandwidth on a transaction bus to facilitate communication of both thefunctional read transaction and the movements of cache lines within theL1 cache subsystem 304 that will result from that read transaction.However, in certain cases, the L1 controller 310 makes changes to the L1main cache 314 and/or L1 victim cache 316 that are not coupled to atransaction that would be communicated to the L2 controller 320. Inthese cases, the L2 controller 320 needs to be made aware of the changesto L1 main cache 314 and/or L1 victim cache 316 in another way.

In particular, for accurate coherent behavior, the L2 controller 320maintains an accurate directory of the lines held in the L1 main cache314 and L1 victim cache 316 (e.g., as shadow copies). This enables theL2 controller 320 to send snoop transactions to the L1 controller 320 toget the most up to date copy of the data when the L2 controller 320knows the line is cached in the L1 cache subsystem 304.

When the L1 controller 310 determines it must evict a non-modified linefrom the L1 victim cache 316 (e.g., for various reasons dependent onworkload), the L1 controller 310 is configured in an example to informthe L2 controller 320 that the line is no longer held in the L1 cachesubsystem 304. In an example, the L1 controller 310 does not inform theL2 controller 320 that the line is no longer held in the L1 cachesubsystem 304. If the L1 controller 310 did not notify the L2 controller320 that the line is no longer present, the L2 controller 320 may sendat least one more snoop transaction to the address at a later time,believing that the line is still held in the L1 cache subsystem 304.When the line is not found, the L1 controller will return a snoopresponse indicating that the line was not present. This concept isdescribed as a snoop miss, and results in unnecessary delays when theline was evicted knowingly by the L1 controller.

Examples of this disclosure address the foregoing by utilizing a tagupdate bus to employ a single cycle, pulsed protocol that enables the L1controller 310 to communicate with the L2 controller 320 outside of thetransaction-based sideband signaling protocol explained above. The tagupdate bus is separate from the transaction bus described above.Similarly to the transaction bus, the tag update bus is representedschematically by the coupling between the L1 cache subsystem 304 and theL2 cache subsystem 306 (or similar couplings between L1 and L2structures in FIGS. 1 and 2). Further, unlike transactions received overthe transaction bus, which are held in a buffer and arbitrated beforebeing utilized by the L2 controller 320, the information provided overthe tag update bus is usable by the L2 controller 320 upon receipt. Thetag update bus protocol allows the L2 controller 320 to accuratelymaintain the shadow L1 main cache 326 and the shadow L1 victim cache328. In some cases, the tag update bus protocol is in the form ofparallel signal groups, allowing the L1 controller 310 to communicatetwo or more cache updates to the L2 controller 320 per cycle.

By communicating the invalidations to the L2 controller 320, unnecessarysnoop transactions can be avoided, resulting in shorter latencies forprocessing transactions in the L2 cache subsystem 306. Additionally,power savings may be realized by reducing the number of RAM accessesrequired by multiple arbitrations for the command that resulted in asnoop miss.

FIG. 10 shows a table 1000 of tag update bus protocol data in accordancewith an example of this disclosure. The scope of this disclosure is notlimited to any particular arrangement of signals within the tag updatebus. In the table 1000, the t0_req and t1_req signals indicate whetherthe other t0 and t1 signals, respectively, are valid for use. When theL2 controller 320 detects that the t0_req or t1_req signals areasserted, the L2 controller 320 processes the remaining tag update bussignals. The t0_address and t1_address signals indicate the addressesfor the cache line having its coherence state updated. The t0_mesi andt1_mesi signals indicate the cache coherence state (e.g., MESI state)for the cache line identified by t0_address and t1_address,respectively. The main_secure and victim_secure signals indicate whetherthe cache line identified by t0_address and t1_address, respectively, issecure.

In certain examples, t0_address and t1_address comprises an address ineither the L1 main cache 314 or the L1 victim cache 316, while in otherexamples the tag update bus is used solely to communicate updates tocoherence state information for cache lines in the L1 victim cache 316.In some examples, t0_mesi and t1_mesi could indicate any final cachecoherence state for the cache line identified by t0_address andt1_address. The tag update bus provides the L1 controller 310 a means tocommunicate the cache line invalidations that result from the L1controller 310, while avoiding the snoop miss scenario described above.

The L2 controller 320 is thus configured to receive, over the tag updatebus separate from a transaction bus, a message from the L1 controller310 that includes a valid signal (e.g., t0_req), an address (e.g.,t0_address), and a cache coherence state (e.g., t0_mesi). The messagethus details an update to cache line coherence state(s) that will occurin the L1 cache subsystem 304.

The L2 controller, in response to the valid signal being asserted, isconfigured to identify an entry in the shadow L1 main cache 326 or theshadow L1 victim cache 328 having an address corresponding to theaddress of the message and update a coherence state of the identifiedentry to be the coherence state of the message. In one example, the L2controller 320 is configured only to identify an entry in the shadow L1victim cache 328 having the address of the message. Concurrently, the L2controller 320 may receive transactions over the transaction bus fromthe L1 controller 310. These transactions are separate from the messagereceived over the tag update bus.

In some examples, the L2 cache subsystem 306 includes a transactionfirst-in, first-out buffer (FIFO, not shown for simplicity) coupled tothe transaction bus that stores transactions received from the L1 cachesubsystem 304 pending processing of those transactions by the L2controller 320. Messages received by the L2 controller 320 over the tagupdate bus are not stored in the transaction FIFO, and are insteadprocessed by the L2 controller 320 upon receipt of an asserted validsignal (e.g., t0_req).

In accordance with some examples of this disclosure, the L2 controller320 exists in a system-wide MESI cache coherence implementation asdescribed above. However, the L2 controller 320 is configured to remapcertain transactions from certain masters to implement a local MEIprotocol between the L2 controller 320 and the L1 controller 310 or theL3 controller 309. In certain circumstances, remapping from MESI to MEIby the L2 controller 320 enables higher performance on read/writesoftware workloads where memory locations are frequently read beforebeing written to. For example, in a multi-core coherence solution,multiple caches can hold a cache line in the shared state. When onecache needs to modify the line, it must first initiate messaging to adownstream (e.g., numerically higher) controller which results in eachof the other caches receiving an invalidating snoop to remove theircopy. Finally, once snoop responses have been received, the initiatingcache updates the cache coherence state of the line from shared toexclusive. The initiating cache then performs its cache line write andtransitions the cache line to the modified state. Thus, when a line isactively shared between multiple different caches, and modifiedfrequently, the number of coherence messages (read, write, victim,snoop) that are required can become large, negatively impacting theperformance of software executing on the CPU core 302. Suppression ofthe shared state by the L2 controller 320 causes each cache lineallocation to bring the line in the exclusive state, reducing the needfor future coherent messaging when a modification of the cache lineoccurs

FIG. 11 shows a block diagram of an exemplary flow 1100 of a transactionfrom the L1 controller, shown here as block 1102, to the L2 instructionpipeline 1112, prior to being processed by the L2 controller 320. In theexample of FIG. 11, it is assumed that the transaction originates fromthe L1 controller 1102; however, as will be explained further below,multiple masters could also issue the transaction. Regardless of theissuing master, the transaction is represented by block 1104 as atransaction that would invoke or generate a cache line in the sharedcoherence state.

In accordance with examples of this disclosure, the L2 controller 320suppresses the shared state by applying opcode mapping logic 1106 to thetransaction 1104. As will be explained further below, the opcode mappinglogic 1106 maps a transaction opcode to a subset of opcodes for thefinal coherent cache state of the cache line comprising the modified,exclusive, or invalid states. In particular, opcodes that would haveresulted in a final cache line coherence state of shared are remapped toone of this subset of opcodes. The opcode mapping logic 1106 need notmap opcodes that would have resulted in a final cache state of modified,exclusive, or invalid.

The first request, or transaction 1104, is thus mapped to a secondrequest demonstrated by block 1108, which avoids invoking the sharedcoherence state. The second request is then arbitrated as normal by L2arbitration logic 1110 and enters the L2 instruction pipeline 1112, tobe subsequently processed by the L2 controller 320.

In some examples, the L2 cache subsystem 306 includes a configurationregister shown as block 1107, which includes a shared field. The sharedfield allows the L2 cache subsystem 306 to be programmaticallyconfigured to either suppress the shared state, or not to suppress theshared state (e.g., not perform opcode mapping and function as a part ofthe larger MESI-based coherence system, described above). For example,if the shared field in configuration register 1107 is asserted, then theopcode mapping logic 1106 is not employed to map transaction opcodes tothat would have resulted in a final cache line coherence state ofshared. Thus, if a transaction 1104 is received as a third request whenthe shared field is asserted, the third request is processed by the L2controller 320 without having its opcode mapped by the opcode mappinglogic 1106.

FIG. 12 shows a flow chart of a method 1200 in accordance with variousembodiments. The method 1200 begins in block 1202 with the L2 controller320 receiving a first request for a cache line in a shared cachecoherence state. The request may be received from the L1 controller 310as a read request, from the streaming engine 210 as a CMO that requiresthe L2 controller 320 to issue a snoop to the L1 controller 310, or fromthe L3 controller 309 as a snoop that requires the L2 controller 320 toissue a snoop to the L1 controller 310.

The method 1200 continues in block 1204 with the L2 controller 320mapping the first request to a second request for a cache line in anexclusive cache coherence state, as explained above. For example, opcodemapping logic 1106 is applied to the opcode of the first request (e.g.,invoking the shared coherence state) to map to the opcode of the secondrequest (e.g., invoking the exclusive coherence state). As explained,the opcode mapping logic 1106 is carried out prior to the requestentering the L2 arbitration logic 1110 and the L2 instruction pipeline1112, and thus being processed by the L2 controller 320. In an example,read requests are either allocating or non-allocating, and eithernon-coherent or coherent. In this example, the opcode mapping logic 1106maps non-coherent allocating reads to a read command without snoop,because no snooping is required for a non-coherent read and readingwithout snooping does not invoke the shared state. Similarly, the opcodemapping logic 1106 also maps non-coherent non-allocating reads to a readcommand without snoop. The opcode mapping logic 1106 maps coherentallocating reads to a read exclusive command, which guarantees that theline will be allocated in the exclusive state. The opcode mapping logic1106 maps coherent non-allocating reads to a read once command, sincethese only need to sample the coherent data (e.g., not allocate), andthus the current owner can keep the line without invoking the sharedstate. In another example, certain snoop commands (e.g., from the L3controller 309) or CMOs have an opcode that would normally require aline to transition to the shared state. In this example, the opcodemapping logic 1106 maps such snoop commands and CMOs to a snoop commandor CMO, respectively, that requires the line to instead transition tothe invalid state. Additionally, if the L2 controller 320 determines tosend a snoop command to the L1 controller 310, the opcode mapping logic1106 maps such a snoop command to a snoop command that requires the L1controller 310 to instead transition the line to the invalid state.

The method 1200 then continues in block 1206 with the L2 controller 320responding to the second request, if the second request is of a typethat warrants a response (e.g., if the second request is a readresponse, a read response is warranted). In the event that the requestedcache line is stored in the L2 cache subsystem 306, as part of itsresponse, the L2 controller 320 transitions a coherence state of thecache line to invalid rather than shared. Alternately, the method 1200continues in block 1208 with forwarding the second request. For example,where the first request results in a snoop being issued by the L2controller 320, the L2 controller forwards the second request for thecache line in the exclusive state, rather than the shared state.

In some examples, the L1 controller 310 determines to change a size ofthe L1 main cache 314. For example, the L1 main cache 314 may be anallocated region of the larger L1 SRAM 312 that can grow (e.g., from 32KB to 64 KB) or shrink (e.g., from 32 KB to 16 KB) in size over time,depending on requirements communicated to the L1 controller 310, forexample from the CPU core 302 or software executing thereon. The L2controller 320 needs to be aware of changes in size to the L1 main cache314, so that the L2 controller 320 can properly maintain (e.g., changethe size of) its shadow L1 main cache 326.

The following protocol enables the L2 controller 320, in an example, tochange the size of its shadow L1 main cache 326 while avoiding datacorruption and/or transaction deadlocks (e.g., where a first transactionrelies on a second transaction, which is pending resolution of the firsttransaction). In one example, sideband signals of the transaction bus(explained above) are used by the L1 controller 310 to communicate thesize change of the L1 main cache 314 to the L2 controller 320. In thisexample, reference is made to certain ones of the sideband signals ofthe transaction bus, in particular referred to as: global_on,global_coh_type, and cache_size. The global_on signal indicates that theL1 controller 310 is performing a global operation on its L1 main cache314. The global_coh_type signal indicates the type of global coherenceoperation being performed on the L1 main cache 314. In the specificexample of a size change of the L1 main cache 314, the global_coh_typewill be a writeback invalidate operation. During a cache size change,coherence is maintained by writing the data to the endpoint and byinvalidating the cacheline. The cache_size signal indicates the size towhich the L1 main cache 314 is transitioning.

FIG. 13 shows a flow chart of a method 1300 for changing the size of theL1 main cache 314, and the resultant change in size of the shadow L1main cache 326. The method 1300 begins in block 1302 with determining,by the L1 controller 310, to change a size of the L1 main cache 314.This determination to change the cache size is, for example, the resultof a control or configuration register write programming a configurationregister of the L1 controller 310 to indicate the desired new cache sizeand initiate the cache size change.

The method 1300 continues in block 1304 with the L1 controller 310servicing pending read and write requests from a CPU core, such as theCPU core 302. The method 1300 then continues in block 1306 in which theL1 controller 310 stalls new read and write requests from the CPU core302. This allows the L1 controller 310 to work through pending requestsbut restrict new requests so that it may perform the global operation(e.g., writeback invalidate and cache size change) on the L1 main cache314.

The method 1300 continues in block 1308 with the L1 controller 310writing back and invalidating the L1 main cache 314. At this point inthe method 1300, the L1 controller 310 asserts the global_on signal toindicate it is performing a global operation, and the global_coh_typeindicates a writeback invalidate as explained above. The L1 controller310 is configured to send victims to the L2 controller 320 during thisstage, which enables the L2 controller 320 to update the shadow L1 mainand victim caches 326, 328. If the victim hits in the L2 cache 324, theL2 controller 320 is also configured to update that cache line with thevictim data. If the victim is not present in L2 cache 324, the L2controller 320 forwards the victim (e.g., to the L3 controller 309).During the size change of the L1 main cache 314, coherence is maintainedwriting the data back to the endpoint and invalidating the cache line.While the L1 controller 310 writes back and invalidates the L1 maincache 314, the L1 controller 310 is also configured to accept and stalla snoop request from the L2 controller 320.

While the L1 controller 310 asserts the global_on signal (e.g., during aglobal operation), the L1 controller 310 also de-asserts a ready signal,which indicates to the CPU core 302 not to send the L1 controller 310additional requests for a cache size change or other global coherenceoperations. The ready signal remains de-asserted until the globaloperation is completed (e.g., the global_on signal is de-asserted).

Once the global_on signal is de-asserted, the L1 controller 310 respondsto any pending snoop transactions that were received from the L2controller 320 and stalled by the L1 controller 310 during the writebackinvalidate (e.g., the global coherence operation for L1 main cache 314size change). In an example, the L1 controller 310 responds to thepending snoop transactions with a response indicating a cache missbecause the L1 main cache 314 is invalidated as part of the size changeprotocol. Once the global_on signal is de-asserted, the L1 controller310 also begins accepting read and write requests from the CPU core 302using the new cache size for the L1 main cache 314. At this point the L1controller 310 has implemented the functionality to change the size ofits L1 main cache 314.

The method 1300 then continues to block 1310 in which the L2 controller320 receives an indication that the L1 main cache 314 has beeninvalidated and had its size changed. In an example, the L1 controller310 sends such an indication to the L2 controller in response to the L1controller 310 having received write responses for all victims writtenback by the L1 controller 310, while no further victims are pending tobe written back by the L1 controller 310.

In this example, the L1 controller 310 uses sideband signals ofglobal_on, global_coh_type, and cache_size to communicate that the L1main cache 314 has been invalidated and had its size changed. Forexample, when global_coh_type indicates a writeback invalidate and thecache_size signal has changed, the L1 controller 310 de-assertingglobal_on indicates to the L2 controller 320 that the L1 main cache 314has been invalidated and had its size changed. This indication allowsthe L2 controller 320 to begin the process of resizing its shadow L1main cache 326. To begin resizing the shadow L1 main cache 326, the L2controller 320 flushes its pipeline, or completes all transactions thatare present in its pipeline while stalling transactions from othermasters.

In some examples, the L2 controller 320 flushes its pipeline in separatephases, which include a blocking soft stall phase, a non-blocking softstall phase, and a hard stall phase. In general, blocking transactionsinclude read requests and write requests that are not victims, whichhave the potential to create a secondary transaction (e.g., a snoop),while non-blocking transactions include victims, snoops, and allresponses.

In an example, during the blocking soft stall phase, the L2 controller320 stalls all blocking transactions, such as fetches, read requests,and write requests from the CPU core 302 and DMA read/write accesses(e.g., from another CPU core) but allows response transactions,non-blocking snoop and victim transactions to be accepted andarbitrated. In some examples the L2 controller 320 flushes its pipelineover several cycles. Following the blocking soft stall phase, the L2controller 320 enters the non-blocking soft stall phase, in which the L2controller 320 allows response transactions and victims but stalls snooptransactions, in addition to the blocking transactions already stalledin the blocking soft stall phase. As a result, the L2 controller 320does not initiate new snoops to the L1 main cache 314 for linespreviously cached in in the L1 main cache 314.

After the L2 controller 320 pipeline is flushed, the method 1300continues to block 1312 in which the L2 controller 320 stalls requestsreceived from any master. This phase is the hard stall phase referred toabove. In particular, the L2 controller 320 pipeline is flushed, the L2controller 320 enforce a hard stall where all transactions, includingresponse transactions, are stalled from all masters.

In some examples, the L2 controller 320 also de-asserts or causes theready signal (explained above with respect to the L1 controller) to bede-asserted. By de-asserting the ready signal, the L2 controller 320prevents the CPU core 302 from sending requests for a cache size changeor other global coherence operation until the L2 controller 320 hascompleted the currently-pending request (e.g., a cache size change). Inone example, the ready signal provided to the CPU core 302 comprises alogical AND of a ready signal from the L1 controller 310 and the L2controller 320. That is, the CPU core 302 only receives an assertedready signal when both the L1 controller 310 and the L2 controller 320assert their ready signals (e.g., when the cache size change operationis complete).

When the hard stall is enforced in block 1312, the method 1300 thencontinues to block 1314 in which the L2 controller 320 reinitializes theshadow L1 main cache 326 to clear its previous contents (e.g.,invalidate cache lines previously held in the shadow L1 main cache 326)and change a size of the shadow L1 main cache 326. In some examples,reinitializing the shadow L1 main cache 326 takes several cycles, duringwhich the L2 controller 320 continues to enforce the hard stall on othermasters. Once the shadow L1 main cache 326 is reinitialized, the L2controller 320 unstalls the masters and asserts its ready signal. The L2controller 320 then begins to process pending transactions from one ormore holding buffers, and accepts new transactions. At this point thesize change protocol execution is complete. In some cases, the L1controller 310 sends a transaction (e.g., a read request) to the L2controller 320 while the L2 controller 320 is flushing its pipeline inblock 1310 or stalled in block 1312, and thus the transaction from theL1 controller 310 is stalled as well. The L2 controller 320 responds tosuch transactions after reinitializing the shadow L1 main cache 326.

In the foregoing discussion and in the claims, the terms “including” and“comprising” are used in an open-ended fashion, and thus should beinterpreted to mean “including, but not limited to . . . .” Also, theterm “couple” or “couples” is intended to mean either an indirect ordirect connection. Thus, if a first device couples to a second device,that connection may be through a direct connection or through anindirect connection via other devices and connections. Similarly, adevice that is coupled between a first component or location and asecond component or location may be through a direct connection orthrough an indirect connection via other devices and connections. Anelement or feature that is “configured to” perform a task or functionmay be configured (e.g., programmed or structurally designed) at a timeof manufacturing by a manufacturer to perform the function and/or may beconfigurable (or re-configurable) by a user after manufacturing toperform the function and/or other additional or alternative functions.The configuring may be through firmware and/or software programming ofthe device, through a construction and/or layout of hardware componentsand interconnections of the device, or a combination thereof.Additionally, uses of the phrases “ground” or similar in the foregoingdiscussion are intended to include a chassis ground, an Earth ground, afloating ground, a virtual ground, a digital ground, a common ground,and/or any other form of ground connection applicable to, or suitablefor, the teachings of the present disclosure. Unless otherwise stated,“about,” “approximately,” or “substantially” preceding a value means+/−10 percent of the stated value.

The above discussion is meant to be illustrative of the principles andvarious embodiments of the present disclosure. Numerous variations andmodifications will become apparent to those skilled in the art once theabove disclosure is fully appreciated. It is intended that the followingclaims be interpreted to embrace all such variations and modifications.

What is claimed is:
 1. A method, comprising: determining, by a level one(L1) controller, to change a size of a L1 main cache; servicing, by theL1 controller, pending read requests and pending write requests from acentral processing unit (CPU) core; stalling, by the L1 controller, newread requests and new write requests from the CPU core; writing back andinvalidating, by the L1 controller, the L1 main cache; receiving, by alevel two (L2) controller, an indication that the L1 main cache has beeninvalidated and, in response, flushing a pipeline of the L2 controller;in response to the pipeline being flushed, stalling, by the L2controller, requests received from any master; and reinitializing, bythe L2 controller, a shadow L1 main cache, wherein reinitializingcomprises clearing previous contents of the shadow L1 main cache andchanging the size of the shadow L1 main cache.
 2. The method of claim 1,further comprising, while the L1 controller is writing back andinvalidating the L1 main cache: accepting and stalling, by the L1controller, a snoop request from the L2 controller.
 3. The method ofclaim 2, further comprising, in response to the L1 main cache beinginvalidated: responding, by the L1 controller, to the snoop request fromthe L2 controller with a snoop response indicating a cache miss.
 4. Themethod of claim 1, further comprising, while the L1 controller iswriting back and invalidating the L1 main cache: receiving, by the L2controller, a victim cache line from the L1 controller.
 5. The method ofclaim 1, further comprising transmitting, by the L1 controller, theindication that the L1 main cache has been invalidated in response to:receiving, by the L1 controller, write responses for all victim cachelines written back by the L1 controller while no further victim cachelines are pending to be written back by the L1 controller.
 6. The methodof claim 1, wherein the L2 controller flushing the pipeline furthercomprises: enforcing, by the L2 controller, a soft stall on one or moremasters, wherein during the soft stall the L2 controller acceptsresponses to previous read requests or write requests from the one ormore masters and stalls new read requests or write requests from the oneor more masters.
 7. The method of claim 1, further comprising, inresponse to the reinitializing of the shadow L1 main cache beingcomplete: unstalling, by the L2 controller, requests received from anymaster.
 8. The method of claim 1, further comprising, in response to thereinitializing of the shadow L1 main cache being complete: receiving, bythe L1 controller, a read response for a read request issued by the L1controller while the L2 controller was flushing its pipeline or stallingrequests from any master.
 9. An apparatus, comprising: a centralprocessing unit (CPU) core; a level one (L1) cache subsystem coupled tothe CPU core, the L1 cache subsystem comprising: a L1 main cache; and aL1 controller configured to: determine to change a size of the L1 maincache; service pending read requests and pending write requests from theCPU core; stall new read requests and new write requests from the CPUcore; and write back and invalidate the L1 main cache; a level two (L2)cache subsystem coupled to the L1 cache subsystem, the L2 cachesubsystem comprising: a L2 main cache; a shadow L1 main cache; and a L2controller configured to: receive an indication that the L1 main cachehas been invalidated and, in response, flush a pipeline of the L2controller; in response to the pipeline being flushed, stall requestsreceived from any master; and reinitialize the shadow L1 main cache,wherein reinitializing comprises clearing previous contents of theshadow L1 main cache and changing the size of the shadow L1 main cache.10. The apparatus of claim 9, wherein while the L1 controller is writingback and invalidating the L1 main cache, the L1 controller is furtherconfigured to: accept and stall a snoop request from the L2 controller.11. The apparatus of claim 10, wherein, in response to the L1 main cachebeing invalidated, the L1 controller is further configured to: respondto the snoop request from the L2 controller with a snoop response thatindicates a cache miss.
 12. The apparatus of claim 9, wherein while theL1 controller is writing back and invalidating the L1 main cache, the L2controller is further configured to: receive a victim cache line fromthe L1 controller.
 13. The apparatus of claim 9, wherein the L1controller is further configured to transmit the indication that the L1main cache has been invalidated in response to receipt by the L1controller of write responses for all victim cache lines written back bythe L1 controller while no further victim cache lines are pending to bewritten back by the L1 controller.
 14. The apparatus of claim 9, whereinwhen the L2 controller flushes the pipeline, the L2 controller isfurther configured to: enforce a soft stall on one or more masters;wherein during the soft stall the L2 controller is configured to: acceptresponses to previous read requests or write requests from the one ormore masters; and stall new read requests or write requests from the oneor more masters.
 15. The apparatus of claim 9, wherein the L2 controlleris further configured to, in response to the reinitializing of theshadow L1 main cache being complete: unstall requests received from anymaster.
 16. The apparatus of claim 9, wherein the L1 controller isfurther configured to, in response to the reinitializing of the shadowL1 main cache being complete: receive a read response for a read requestissued by the L1 controller while the L2 controller was flushing itspipeline or stalling requests from any master.
 17. A method, comprising:receiving, by a level two (L2) controller, an indication that the alevel one (L1) main cache has been invalidated and, in response,flushing a pipeline of the L2 controller; in response to the pipelinebeing flushed, stalling, by the L2 controller, requests received fromany master; and reinitializing, by the L2 controller, a shadow L1 maincache, wherein reinitializing comprises clearing previous contents ofthe shadow L1 main cache and changing the size of the shadow L1 maincache.
 18. The method of claim 17, further comprising, prior toreceiving the indication that the L1 main cache has been invalidated:receiving, by the L2 controller, a victim cache line from the L1controller.
 19. The method of claim 17, wherein the L2 controllerflushing the pipeline further comprises: enforcing, by the L2controller, a soft stall on one or more masters, wherein during the softstall the L2 controller accepts responses to previous read requests orwrite requests from the one or more masters and stalls new read requestsor write requests from the one or more masters.
 20. The method of claim17, further comprising, in response to the reinitializing of the shadowL1 main cache being complete: unstalling, by the L2 controller, requestsreceived from any master.